home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Development Tools & Languages / • Other Platforms / PCCTS 1.31 / h / List.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-10  |  2.0 KB  |  68 lines  |  [TEXT/MPS ]

  1. #ifndef List_h
  2. #define List_h
  3.  
  4. /*
  5.  * List.h
  6.  *
  7.  * SOFTWARE RIGHTS
  8.  *
  9.  * We reserve no LEGAL rights to SORCERER -- SORCERER is in the public
  10.  * domain.  An individual or company may do whatever they wish with
  11.  * source code distributed with SORCERER or the code generated by
  12.  * SORCERER, including the incorporation of SORCERER, or its output, into
  13.  * commerical software.
  14.  * 
  15.  * We encourage users to develop software with SORCERER.  However, we do
  16.  * ask that credit is given to us for developing SORCERER.  By "credit",
  17.  * we mean that if you incorporate our source code into one of your
  18.  * programs (commercial product, research project, or otherwise) that you
  19.  * acknowledge this fact somewhere in the documentation, research report,
  20.  * etc...  If you like SORCERER and have developed a nice tool with the
  21.  * output, please mention that you developed it using SORCERER.  In
  22.  * addition, we ask that this header remain intact in our source code.
  23.  * As long as these guidelines are kept, we expect to continue enhancing
  24.  * this system and expect to make other tools available as they are
  25.  * completed.
  26.  *
  27.  * PCCTS 1.31
  28.  * Terence Parr
  29.  * Parr Research Corporation
  30.  * with Purdue University and AHPCRC, University of Minnesota
  31.  * 1992-1995
  32.  */
  33.  
  34. #include <stdio.h>
  35. #include <stdlib.h>
  36.  
  37. #include "PCCTSAST.h"
  38.  
  39. class PCCTS_AST;
  40.  
  41. class ListNode {
  42. protected:
  43.     void *_elem;            /* pointer to any kind of element */
  44.     ListNode *_next;
  45. public:
  46.     ListNode()                {_elem=_next=NULL;}
  47.     virtual ~ListNode()        {_elem=_next=NULL;}
  48.     void *elem()            { return _elem; }
  49.     void setElem(void *e)    { _elem = e; }
  50.     setNext(ListNode *t)    { _next = t; }
  51.     ListNode *next()        { return _next; }
  52. };
  53.  
  54. class List {
  55.     ListNode *head, *tail;
  56. public:
  57.     List() {head=tail=NULL;}
  58.     virtual ~List() {head=tail=NULL;}
  59.     virtual void *iterate(ListNode **);
  60.     virtual void add(void *e);
  61.     virtual void lfree();
  62.     virtual PCCTS_AST *to_ast(List list);
  63.     require(int e,char *err){ if ( !e ) panic(err); }
  64.     virtual panic(char *err){ fprintf(stderr, "List panic: %s\n", err); exit(1); }
  65. };
  66.  
  67. #endif
  68.